package com.zhongkai.controller;

import com.zhongkai.app.service.BigClientService;
import com.zhongkai.model.utils.ZhongkaiResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BigClientController {

    @Autowired
    private BigClientService bigClientService;


    /**
     * 状态监控
     *
     * @param page 当前页数
     * @param rows 每页数据条数
     */
    @RequestMapping(value = "/big_client/list", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult bigClientList(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer rows) {

        ZhongkaiResult province = null;
        province = bigClientService.bigClientList(page, rows);


        return province;
    }


    /**
     * 大客户名下所有设备
     *
     * @param page      当前页数
     * @param rows      每页数据条数
     * @param user_uuid 大客戶uuid
     */
    @RequestMapping(value = "/big_client/unit_list", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult bigClientUnitList(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer rows, String user_uuid) {

        ZhongkaiResult province = null;
        province = bigClientService.bigClientUnitList(page, rows, user_uuid);


        return province;
    }


    /**
     * 大客户名下所有设备 (902)
     * @param page      当前页数
     * @param rows      每页数据条数
     * @param user_uuid    当前ERP用户uuid
     * @param warning    是否报警 0正常  1报警
     */
    @RequestMapping(value = "/big_client/client_user_list", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult bigClientUser(@RequestParam(defaultValue = "0") Integer page,
                                        @RequestParam(defaultValue = "0") Integer rows, String user_uuid, Integer warning) {

        ZhongkaiResult province = null;
        province = bigClientService.bigClientUser(page, rows, user_uuid,warning);

        return province;
    }





    /**
     * 设备搜素
     * @param page      当前页数
     * @param rows      每页数据条数
     * @param user_name    设备的客户姓名
     * @param user_uuid    大用户uuid
     */
    @RequestMapping(value = "/big_client/search_unit", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult searchClientUnit(@RequestParam(defaultValue = "0") Integer page,
                                        @RequestParam(defaultValue = "0") Integer rows, String user_name,String user_uuid) {


        ZhongkaiResult province = bigClientService.searchClientUnit(page, rows, user_name,user_uuid);


        return province;
    }



    /**
     * 根据uuid获取设备详情
     *
     * @param unit_uuid    设备uuid
     */
    @RequestMapping(value = "/big_date/get_unit", produces = "application/json;charset=utf-8")
    @ResponseBody
    public ZhongkaiResult getUnitData(String unit_uuid) {

        ZhongkaiResult  province = bigClientService.getUnitData(unit_uuid);


        return province;
    }

}
